//
//  BDatabaseSQL.h
//  readNovels
//
//  Created by 吳瀾洲 on 2020/4/27.
//  Copyright © 2020 wulanzhou. All rights reserved.
//

#ifndef BDatabaseSQL_h
#define BDatabaseSQL_h

//创建数据库与表sql


//默认数据库名
#define database_name @"book.db"

/******************create table sql*****************/

//创建书籍表
#define book_table_sql @"create table if not exists book (\
id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL ,\
name VARCHAR(50) NOT NULL ,\
author VARCHAR(20),\
price DOUBLE,\
publisher VARCHAR(100),\
isbn VARCHAR(20),\
status INTEGER,\
ctime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),\
mtime DATETIME)"

//创建目录表
#define catalog_table_sql @"create table if not exists catalog (\
id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL ,\
book_id INTEGER NOT NULL ,\
serial_number VARCHAR(20) NOT NULL ,\
name VARCHAR(50) NOT NULL ,\
page_url VARCHAR(200),\
sort INTEGER,\
memo VARCHAR(200),\
ctime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),\
mtime DATETIME)"

//创建章节表
#define chapter_table_sql @"create table if not exists chapter (\
catalog_id INTEGER PRIMARY KEY ,\
title VARCHAR(50),\
content TEXT,\
finished REAL DEFAULT 0,\
sort INTEGER,\
memo VARCHAR(200),\
ctime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),\
mtime DATETIME)"


#endif /* BDatabaseSQL_h */
